﻿<?php
session_start();
//kiem tra co dang nhap hay khong
include("ktdangnhap.php");
?>
<html>
<head>
<link rel="stylesheet" href="menu.css" type="text/css">
<link rel="stylesheet" href="kt.css" type="text/css">
</head>
<body>
<?php
//lay menu
  

if(isset($_GET["id"]))
{
	include("menu.php");
	$id=$_GET["id"];
	//ket noi voi co so du lieu
	include("connect.php");
	//cau lenh sql
	$sql="select * from cau_hoi a join kt_cau_hoi b on a.ID=b.ID where MA_KT=$id";
	$query=mysql_query($sql);
	if(mysql_num_rows($query)==0)
	{
		echo"Chưa có bài câu hỏi trong bài kiểm tra này";
	}
	else
	{
		$stt=0;
		echo"<div id='ktra'>";
		echo"<form method='post' action='dapan.php'>";
		while($row=mysql_fetch_array($query))
		{
			$stt++;
			echo"<div class='cauhoi'>";
			
					echo"<b>Câu $stt</b><br>";
					echo $row["NOI_DUNG"]."<br><br>";
					echo"Chọn một đáp án: <br>";
						echo "<input type='radio' name='".$row["ID"]."' value='A'>a. ".$row["A"]."<br>";
						echo "<input type='radio' name='".$row["ID"]."' value='B'>b. ".$row["B"]."<br>";
						echo "<input type='radio' name='".$row["ID"]."' value='C'>c. ".$row["C"]."<br>";
						echo "<input type='radio' name='".$row["ID"]."' value='D'>d. ".$row["D"]."<br>";

			echo"</div>";

		}
		echo"<div align='center'>";
		echo"<input type='hidden' name='MA_KT' value='$id'>";
		echo"<input type='submit' name='ok' value='Nộp bài'>";
		echo"</div>";
		echo"</form>";
		echo"</div>";
	}
}
else
{
	header("location:index.php");
}
?>
</body>
</html>